package com.my.login;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.catalina.connector.Request;

public class LoginServlet extends HttpServlet {
	
	private static final long serialVersionUID = 1L;

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();
		
		String userID = request.getParameter("userid");
		String pass   = request.getParameter("password");
		
		if(userID.equals("java") && pass.equals("1234")){
			out.println("<html>");
			out.println("<head><title>사용자 ID: " + userID + "</title></head>");
			out.println("<body>");
			out.println("<center>");
			out.println(userID + "님의 입장을 환영합니다.");
			out.println("</center></body></html>");
			
		}else{
			out.println("아이디와 패스워드를 확인하세요.");
		}
		out.close();
	}

}
